package com.jishuo.nontax.view.controller;

import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.vo.UserVO;
import com.jishuo.nontax.bean.vo.PayDivideVO;
import com.jishuo.nontax.bfc.service.DivideService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * @auther dinggaofei
 * @Date 2023/3/28 16:11
 */
@Slf4j
@Controller
@RequestMapping(value = "/view/divide")
public class DivideViewController {

    private  String prefix  ="view/";
    @Resource
    private DivideService divideService;

    @RequestMapping(value = {"paydivideview", "paydivideview/{page}"}, name = "划解分成柜面页面")
    public String index(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "paydivideview" : page);
    }

    @ResponseBody
    @RequestMapping(value = "paydividepayview",name = "划解分成收款")
    public BaseResult  paydividepayview(String dividebillnum, HttpSession session){
        UserVO user = (UserVO) session.getAttribute("login_user");
        return  divideService.payDividePayView(dividebillnum,user);
    }
    @ResponseBody
    @RequestMapping(value = "queryPayDivideData",name = "划解分成柜面")
    public BaseResult queryPayDivideData(String dividebillnum){
        return  divideService.getPayDivide(dividebillnum);
    }
}
